$(function(){	
	$("#modifyUser").val(username);		
	var src = tl_config.last_url;
	var i = src.indexOf('?');
	var j =src.indexOf('&');

	if(i!=-1){		
		var id = src.substring(i+4,j);
		$("#parentId").val(id);
		gridObj = $.fn.bsgrid.init('g_tabYeh', {
			ajaxType : 'get',
			url :  server_url+'/rest/HelpCenterInfo/HelpCenterInfoList.do?ran=' + Math.random() + '&token=' + token,
			otherParames:{'parentId': id},
			autoLoad : true,
			pageSizeSelect : true,
			stripeRows : true,
			pageSize : 10,
			displayBlankRows : false,
			isProcessLockScreen : true,
			rowSelectedColor : false,
			showPageToolbar:true
		});
	}	
	
});
function operate(record, rowIndex, colIndex, options) {
    return '<a href="javascript:EditHelpCenterChildInfo(\'' + gridObj.getRecordIndexValue(record, 'id') + '\');">编辑</a>';
}
// 数据表格参数查询
function doSearch() {
	searchParames = $('#myform').serialize();	
	gridObj.search(searchParames);
}
//添加
function toHelpCenterChildAdd(){
	var url="goHelpCenterChildInfoAdd.do?ran="+Math.random();
	tl_config.loadToWorkArea(url);
}
// 编辑
function EditHelpCenterChildInfo(id) {
	var url='goHelpCenterChildInfoEdit.do?id='+id;
	tl_config.loadToWorkArea(url);
}

//获取checkbox选中删除
function delCheckedIds() {
	// values are array
	var ids = gridObj.getCheckedValues('id').toString();
	if (ids == "") {
		easyDialog.open({
			container:{
				header:'温馨提示',
				content:"请选择要操作的记录！"
			},
			autoClose : 2000
		});
	} else {
		easyDialog.open({
			  container : {
				  header:'温馨提示',
			    content : '您确定要删除吗？',
			    yesFn : function(){
			    	$.ajax({
						url : server_url+'/rest/HelpCenterInfo/HelpCenterInfoDel.do',
						type : 'post',
						dataType : 'json',
						data : {
							updateUser:username,
							ids : ids,
							token:token
						},
						success : function(data) {
							if (data.retCode = "0000") {								
								var url="getHelpCenterChildListPage.do?ran="+Math.random();
								tl_config.loadToWorkArea(url);
								
							} else{
								  easyDialog.open({container:{header:'温馨提示',content:data.retMsg},autoClose : 2000});
							}  
						}
					});
			    },
			    noFn : true
			  }
			});
		
	}
}
